package wotd.web;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import wotd.BibleQuery;

import com.google.inject.Inject;
import com.google.inject.Singleton;

@Singleton
@SuppressWarnings("serial")
public class LookupServlet extends HttpServlet {
	
	/** the excerpt finder */
	@Inject BibleQuery query;
	
	@Override
	public void doGet(HttpServletRequest req, final HttpServletResponse resp) throws IOException {
		resp.setContentType("text/html");

		String passage = req.getParameter("q");
		String verse = query.query(passage);

		resp.getWriter().print(verse);
		resp.getWriter().flush();
	}
}
